Mind Palace I [PPC]

Mind Palace I

It looks like the situation is hopeless, there is no time to think. However, you can use the mind palace and solve all problems instantly.

URL: nc 212.47.229.1 33001

Recon

Server sends pip, piiiip, or an empty string. Looks like morse code.

A script was made to decode incoming morse code, it reveals the following string:

hereuponthelapelofmycoatyoumayseetheribbonofmydecorationbutthemedalitselfikeepinaleathernpouchathomeflagsherlocklikesyourmorse.

Code

import pwn

morse = {
    '.-': 'a',
    '-...': 'b',
    '-.-.': 'c',
    '-..': 'd',
    '.': 'e',
    '..-.': 'f',
    '--.': 'g',
    '....': 'h',
    '..': 'i',
    '.---': 'j',
    '-.-': 'k',
    '.-..': 'l',
    '--': 'm',
    '-.': 'n',
    '---': 'o',
    '.--.': 'p',
    '--.-': 'q',
    '.-.': 'r',
    '...': 's',
    '-': 't',
    '..-': 'u',
    '...-': 'v',
    '.--': 'w',
    '-..-': 'x',
    '-.--': 'y',
    '--..': 'z',
    '/': ' ',
    '.----': '1',
    '..---': '2',
    '...--': '3',
    '....-': '4',
    '.....': '5',
    '-....': '6',
    '--...': '7',
    '---..': '8',
    '----.': '9',
    '-----': '0',
    '.-.-.-': '.',
    '--..--': ',',
    '..--..': '?',
    '---...': ':',
    '-....-': '-',
    '-.-.-.': ';',
    '-..-.': '/',
    '..--.-': '_',
    '-.--.': '(',
    '-.--.-': ')',
    '.-.-.': '+',
    '-...-': '='
}

def parse_morse(msg):
    return ''.join([morse[token] for token in msg.split('/') if token in morse])

conn = pwn.remote('212.47.229.1', 33001)
msg = ""
res = True
i = 0
while res:
    res = conn.recv()
    m = res.decode()
    if 'piiiip' in m:
        m = '-'
    elif 'pip' in m:
        m = '.'
    else:
        m = '/'
    msg += m
    i += 1
    if i % 10 == 0:
        print(msg)
        print(parse_morse(msg))
conn.close()
print(msg)
print(parse_morse(msg))

Flag

flag{sherlock_likes_your_morse}